package com.movie.modules.api.controller;

import com.movie.common.utils.R;
import com.movie.modules.api.service.AppService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author JF-PJJ
 */
@RestController
@RequestMapping("/api")
@Api(tags = "首页接口")
public class ApiHomeController {

    @Autowired
    private AppService appService;


    @GetMapping("/search")
    @ApiOperation("首页搜索")
    public R search(String s){
        return appService.homeSearch(s);
    }

    @GetMapping("/banner/home")
    @ApiOperation("首页轮播列表")
    public R homeBanner(){
        return R.ok(appService.bannerList(1));
    }


    @GetMapping("/type/hot/{n}")
    @ApiOperation("热门电影类型列表")
    public R hotType(@PathVariable("n") Integer n){
        return R.ok(appService.typeList(1,n));
    }

    @GetMapping("/movie/hot")
    @ApiOperation("热门电影列表")
    public R hotMovie(){
        return R.ok(appService.hotMovieList());
    }

}
